<template>
  <el-card shadow="never">
    <div slot="header">
      <el-button @click="$router.go(-1)">返回</el-button>
    </div>
    <el-row :gutter="20">
      <el-col :span="6" style="border-right: 1px dashed #cccccc">
        <p>
          <span class="mr10">{{ row.patientName }}</span>
          <span class="mr10">{{ row.patientSex }}</span>
          <span class="mr10">{{ row.patientAge }}</span>
          <span>{{ row.outModel }}</span>
        </p>
        <p>主治医生：{{ row.name }}</p>
        <p>回访次数：{{ row.visitNum }}</p>
        <p>出院科室：{{ row.outDeptName }}</p>
        <p>住院时间：{{ row.inTime }}至{{ row.outTime }}</p>
        <p>住院天数：{{ row.inDays }}</p>
      </el-col>
      <template v-if="list.length > 0">
        <el-col :span="18">
          <el-row :gutter="16">
            <el-col :span="12" v-for="(item,index) in list" :key="index">
              <h3>{{ index+ 1 }}. {{ item.phone }}</h3>
              <p>拨出时间：{{ item.revisitTime }}</p>
              <p>通话时长：{{ item.callDuration }}</p>
              <p>通话备注：{{ item.remark }}</p>
            </el-col>
          </el-row>
        </el-col>
      </template>
      <template v-else>
        <empty-comp ref="emptyComp" />
      </template>
    </el-row>
  </el-card>
</template>

<script>
import { getVisitRecordDetails } from '@/api/monitor'
import { getMonitorTime } from '@/utils/util'

export default {
  data() {
    return {
      row: JSON.parse(this.$route.query.row),
      list: [],
      mdl: {}
    }
  },
  async created() {
    console.log('row', this.row)
    let param = getMonitorTime()
    const res = await getVisitRecordDetails({ ...param, userId: this.row.userId, revisitTaskId: this.row.revisitTaskId })
    console.log('res', res)
    if (res.state === '000000') {
      this.list = res.data
    }
  }
}
</script>
